gusucode.com > MATLAB神经网络实例与精析随书源程序 > 第6章 BP神经网络/code/getdata.m
function [data,label]=getdata(xlsfile) % [data,label]=getdata('student.xls') % read height,weight and label from a xls file [~,label]=xlsread(xlsfile,1,'B2:B261'); [height,~]=xlsread(xlsfile,'C2:C261'); [weight,~]=xlsread(xlsfile,'D2:D261'); data=[height,weight]; l=zeros(size(label)); for i=1:length(l) if label{i}== '男' l(i)=1; end end label=l;